/*
 * StartMenuController
 */

package demo;

import java.awt.Graphics;
import java.awt.Point;
import java.util.logging.Level;
import java.util.logging.Logger;
import javaPlay.GameEngine;
import javaPlay.GameState;
import javaPlay.Mouse;
import javaPlay.Sprite;

/**
 * 
 * @author VisionLab/PUC-Rio
 */
public class StartMenuController implements GameState {
	
	private Sprite menu;
	
	public void load() {
		try {
			menu = new Sprite("startmenu.jpg", 1, 800, 600);
		} catch (Exception ex) {
			Logger.getLogger(StartMenuController.class.getName()).log(Level.SEVERE, null, ex);
		}
	}
	
	public void unload() {
		
	}
	
	public void start() {
		
	}
	
	public void step(long gameTime, long timeElapsed) {
		Mouse m = GameEngine.getInstance().getMouse();
		
		if (m.isLeftButtonPressed() == true) {
			Point p = m.getMousePosition();
			
			if ((p.x >= 363) && (p.y >= 353) && (p.x <= 485) && (p.y <= 389)) {
				GameEngine.getInstance().changeGameState(Global.SIMPLE_CONTROLLER_ID);
			}
		}
	}
	
	public void draw(Graphics g) {
		menu.draw(g, 0, 0);
	}
	
	public void stop() {
		
	}
}
